﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="AdminPage.ascx.cs" Inherits="Controls_Template_AdminPage" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<script type="text/javascript">

    $(document).ready(function () {
        SearchText();
        function SearchText() {
            $("#<%=tbTenThanhVien.ClientID %>").autocomplete({
                source: function (request, response) {
                    $.ajax({
                        url: "AutoComplete.asmx / AutoCompleteAjaxRequest",
                        type: "POST",
                        datatype: "json",
                        contentType: "application/json; charset=utf-8",
                        data: "{ 'prefix' : '" + $("#<%=tbTenThanhVien.ClientID %>").val() + "'}",
                        dataFilter: function (data) { return data; },
						success: function (data) {
									response($.map(data.d, function (item) {
										return {
											label: item,
											value: item
										}
									}))
									//debugger;
								},
								error: function (result) {
									alert("Error");
								}
                        });
                },
                minLength: 1,
                delay: 1000
            });
        }
    });

</script>
<div id="content" style="margin-left: 20px">
    <div>
        <h4 style="color: Blue">
            Bài viết chờ duyệt</h4>
        <asp:Repeater ID="rptBaiVietChoDuyet" runat="server">
            <ItemTemplate>
                <asp:HiddenField ID="hdnIDBaiViet" runat="server" Value='<%#Eval("IDBaiViet")%>' />
                <asp:HyperLink Target="_blank" ID="hplTitleBaiViet" runat="server" Text='<%#Eval("TenBai") %>'></asp:HyperLink>
                (<asp:Label ID="lbMauVirus" runat="server" Text='<%#Eval("TenMau") %>'></asp:Label>)<br />
            </ItemTemplate>
        </asp:Repeater>
    </div>
    <div>
        <h4 style="color: Blue">
            Khu vực thành viên</h4>
        <div id="divPhanQuyen">
            <asp:Label ID="lbPhanQuyenThanhVien" runat="server">Phân quyền thành viên: </asp:Label>
            <asp:TextBox ID="tbTenThanhVien" runat="server"></asp:TextBox>
            <cc1:AutoCompleteExtender ServiceMethod="AutoCompleteAjaxRequest" ServicePath="~/Default.aspx"
                MinimumPrefixLength="2" CompletionInterval="100" EnableCaching="false" CompletionSetCount="10"
                TargetControlID="tbTenThanhVien" ID="AutoCompleteExtender1" runat="server" FirstRowSelected="false">
            </cc1:AutoCompleteExtender>
            <asp:Button ID="btnAddTV" class="button" runat="server" Text="Thêm" />
            <asp:Button ID="btnDeleteTV" class="button" runat="server" Text="Xóa" /><br />
            <br />
        </div>
    </div>
</div>
